---
--- Created by heiye.
--- DateTime: 2025/4/22 下午2:30
---

local key = KEYS[1]          -- 操作的 Redis Key
local followQuizId = ARGV[1] -- 关注的问题ID

-- 使用 EXISTS 命令检查 rbitmap 是否存在
local exists = redis.call('EXISTS', key)
if exists == 0 then
    return -1
end

-- 校验目标问题是否已关注
local isFollow = redis.call('R.GETBIT', key, followQuizId)
if isFollow == 0 then
    return -3
end
return 0